import json
import requests
import urllib.request

appId = "wx774cd240921b1c9b"
secret = "5d134bc69439a0cf3c16552afd107014"
grant_type = "authorization_code"


def get_openid(code):
    url = "https://api.weixin.qq.com/sns/jscode2session?appid=%s&secret=%s&js_code=%s&grant_type=authorization_code"% (appId,secret,code)
    res = requests.get(url)
    print(res.text)
    return json.loads(res.text)

# from .WXBizDataCrypt import WXBizDataCrypt

# def get_phone(sessionKey, encryptedData, iv):
#     pc = WXBizDataCrypt(appId, sessionKey)
#     return pc.decrypt(encryptedData, iv)

